#include <stdio.h>
#include "sm2.h"

int main() {
	uint8_t p_random[NUM_ECC_DIGITS] = {0x6F, 0xF9, 0xB2, 0x1F, 0xAE, 0xBA, 0x0D, 0x26, 0x27, 0xB7, 0x72, 0xDD, 0x25, 0xD9, 0x76, 0xC1, 0x3F, 0x66, 0x17, 0x48, 0x93, 0x4E, 0xF9, 0x94, 0x5C, 0x17, 0x5C, 0x38, 0x99, 0x8D, 0xB2, 0x6C};

    EccPoint p_publicKey = { \
    {0xDF, 0x09, 0x69, 0x21, 0x84, 0xE7, 0xC7, 0xEA, 0x5E, 0x91, 0x2C, 0x4C, 0xE2, 0xFF, 0x22, 0x89, 0xEC, 0x3D, 0x2F, 0xA3, 0xAB, 0xC7, 0xA8, 0x21, 0x9F, 0xE3, 0x17, 0x6F, 0xE4, 0x4F, 0xB2, 0xE3},
    {0x27, 0xA7, 0x8D, 0xC1, 0xFB, 0x3D, 0x1C, 0x0C, 0xB0, 0xAC, 0x23, 0xDE, 0x65, 0xB1, 0xDF, 0x1C, 0xF6, 0x75, 0xD2, 0x1F, 0x4C, 0x10, 0xDE, 0x21, 0x3C, 0xCB, 0x68, 0x36, 0xFE, 0x6A, 0x2D, 0xEE}};

    uint8_t p_privateKey[NUM_ECC_DIGITS] = {0xAD, 0x0E, 0x7F, 0xDF, 0x64, 0xFF, 0x25, 0xAE, 0x83, 0x6E, 0x0F, 0x79, 0xA6, 0x93, 0x21, 0xC8, 0xD0, 0x59, 0x86, 0x12, 0x28, 0xC3, 0xF7, 0x83, 0x13, 0x7A, 0x2A, 0xD7, 0xCF, 0xBA, 0x4D, 0x08};

    uint8_t r[NUM_ECC_DIGITS];
    uint8_t s[NUM_ECC_DIGITS];

    uint8_t p_hash[NUM_ECC_DIGITS] = {0x95, 0x8E, 0x72, 0xE6, 0x3C, 0x1B, 0x65, 0xD3, 0x25, 0xAC, 0xF7, 0xF6, 0x50, 0xAF, 0xBA, 0x75, 0x32, 0x5E, 0x22, 0x47, 0x58, 0xB0, 0x7C, 0x10, 0x66, 0xBB, 0xC1, 0x5A, 0xC5, 0x46, 0x89, 0xED};
    
    ecdsa_sign(r, s, p_privateKey, p_random, p_hash);
    printf("%d\n", ecdsa_verify(&p_publicKey, p_hash, r, s));
}
